package ms.zuul.filter;

import lombok.Data;

/**
 * Project Name: ms
 * File Name: MsResponseBody
 * Package Name: ms.zuul.filter
 * Date: 2018/5/9  12:59
 * Copyright (c) 2018, tianyul All Rights Reserved.
 * 响应请求封装
 */
@Data
public class MsResponseBody {
    /**
     * 响应码
     */
    private String code;
    /**
     * 信息，例如：错误信息
     */
    private String msg;
    private Object data;

    public MsResponseBody() {
    }

    public MsResponseBody(ResponseCode responseCode) {
        this(responseCode.getCode(), responseCode.getMsg(), null);
    }

    public MsResponseBody(ResponseCode responseCode, Object data) {
        this(responseCode.getCode(), "", data);
    }

    public MsResponseBody(ResponseCode responseCode, String msg) {
        this(responseCode.getCode(), msg, null);
    }

    public MsResponseBody(String code, Object data) {
        this(code, "", data);
    }

    public MsResponseBody(String code, String msg) {
        this(code, msg, null);
    }

    public MsResponseBody(String code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
}
